package com.chezhujie.www.service;

import com.chezhujie.www.core.exception.ClassCheckException;
import com.chezhujie.www.core.page.Pagination;
import com.chezhujie.www.domain.Czjrefundimage;
import com.chezhujie.www.persistence.CzjrefundimageMapper;
import com.chezhujie.www.utils.UUIDUtils;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.ui.ModelMap;

import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;


/**
 * 退款附加图片
 * Created by 汤伟杰 on 2017/5/23.
 */
@Service
public class CzjrefundimageService extends BaseService<Czjrefundimage>{
    @Autowired
    private CzjrefundimageMapper czjrefundimageMapper;

    @Autowired
    public void setBaseMapper(CzjrefundimageMapper czjrefundimageMapper) {
        this.baseMapper = czjrefundimageMapper;
    }


    public void checkEntity(Czjrefundimage czjrefundimage) throws ClassCheckException {
        if(czjrefundimage.getRefundimageId()!=null&&czjrefundimage.getRefundimageId().length()>19){
            throw new ClassCheckException("退款附加图片主键不能超过19个字符");
        }
        if(czjrefundimage.getImagePath()!=null&&czjrefundimage.getImagePath().length()>200){
            throw new ClassCheckException("退款附加图片图片不能超过200个字符");
        }
        if(czjrefundimage.getRefundId()!=null&&czjrefundimage.getRefundId().length()>19){
            throw new ClassCheckException("退款附加图片退回id不能超过19个字符");
        }
    }
    public void checkListEntity(List<Czjrefundimage> listCzjrefundimage) throws ClassCheckException {

        for (Czjrefundimage czjrefundimage : listCzjrefundimage) {
            checkEntity(czjrefundimage);
        }

    }
}
